home *** CD-ROM | disk | FTP | other *** search
/ Freelog 125 / Freelog_MarsAvril2015_No125.iso / Musique / Quod Libet / quodlibet-3.3.0-installer.exe / bin / quodlibet / qltk / ccb.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2014-12-31  |  2KB  |  44 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.7)
  3.  
  4. from gi.repository import Gtk
  5. from quodlibet import config
  6.  
  7. class ConfigCheckButton(Gtk.CheckButton):
  8.     """A CheckButton that connects to QL's config module, and toggles
  9.     a boolean configuration value when it is toggled.
  10.  
  11.     It is initialised to the current config value if `populate` is set True."""
  12.     
  13.     def __init__(self, label, section, option, populate = False, tooltip = None, default = True):
  14.         super(ConfigCheckButton, self).__init__(label = label, use_underline = True)
  15.         if populate:
  16.             self.set_active(config.getboolean(section, option, default))
  17.         if tooltip:
  18.             self.set_tooltip_text(tooltip)
  19.         self.connect('toggled', ConfigCheckButton._ConfigCheckButton__toggled, section, option)
  20.  
  21.     
  22.     def __toggled(self, section, option):
  23.         config.set(section, option, str(bool(self.get_active())).lower())
  24.  
  25.  
  26.  
  27. class ConfigCheckMenuItem(Gtk.CheckMenuItem):
  28.     """A CheckMenuItem that connects to QL's config module, and toggles
  29.     a boolean configuration value when it is toggled.
  30.  
  31.     It is initialised to the current config value if `populate` is set True."""
  32.     
  33.     def __init__(self, label, section, option, populate = False, default = False):
  34.         super(ConfigCheckMenuItem, self).__init__(label = label, use_underline = True)
  35.         if populate:
  36.             self.set_active(config.getboolean(section, option, default))
  37.         self.connect('toggled', ConfigCheckMenuItem._ConfigCheckMenuItem__toggled, section, option)
  38.  
  39.     
  40.     def __toggled(self, section, option):
  41.         config.set(section, option, str(bool(self.get_active())).lower())
  42.  
  43.  
  44.